package sword.T22;

import util.ListNode;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-03-28 0:20:04 星期一
 */
class Solution {
    public ListNode getKthFromEnd(ListNode head, int k) {
        ListNode q = new ListNode(0, head), p = q;
        for (int i=0; i<k; ++i)
            p = p.next;
        while (p != null) {
            p = p.next;
            q = q.next;
        }
        return q;
    }
}